<template>
    <a-input v-model:value="value" />
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
    'title': {
        default: ''
    },
    // 对于又有参数又有修饰符的 v-model 绑定，生成的 prop 名将是 arg + "Modifiers"
    'titleModifiers': {
        default: () => { return {} }
    }
});

const emit = defineEmits([
    // 为更新事件命名
    'update:title'
]);
const value = ref('');

value.value = props.title;
watch(value, val => {
    if (props.titleModifiers.smile) {
        emit('update:title', val + '😀');
    } else if (props.titleModifiers.cry) {
        emit('update:title', val + '😂');
    } else {
        emit('update:title', val);
    };
}, { immediate: true });


</script>
<style lang="less" scoped>

</style>